<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        //1. 想要一个变量自己加1 num= num + 1；比较麻烦
        var num = 1
        num = num + 1
        num = num + 1//可简写为++num
        console.log(num);//3
        //2.前置递增写法 
        ++num;//类似于 num = num + 1
        console.log(num)//4 
        //3.口诀：先自加，后返回值。
        var p = 20
        console.log(++p + 20);//41 
        console.log(p + 20);//41
        
    </script>
</head>
<body>
    
</body>
</html>